home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / moustr.com / MICETEST.C < prev    next >
Encoding:
C/C++ Source or Header  |  1988-09-21  |  3.5 KB  |  200 lines

  1. #include <stdio.h>
  2. #include "moustrap.h"
  3.  
  4. #include <graph.h>
  5. #pragma comment(lib,"graphics")
  6.  
  7.  
  8. main ()
  9. {
  10.     mouse_t    w,x,y,z,c;
  11.     int    oldcolor;
  12.  
  13.  
  14. /* Set up screen for demo, using Microsoft GRAPHICS library        */    
  15.     
  16.     oldcolor=_gettextcolor();
  17.  
  18.     _clearscreen(_GCLEARSCREEN);
  19.  
  20.     for (x=16; x<26; ++x) {
  21.         _settextposition(x,21);
  22.         _settextcolor(2);
  23.         _outtext("LLLLLLLLLL");
  24.         _settextcolor(4);
  25.         _outtext("RRRRRRRRRR");
  26.         }
  27.     
  28.     
  29.     _settextcolor(1);
  30.     for (x=6; x<17; ++x) {
  31.             _settextposition(x,11);
  32.         _outtext("11111111111");
  33.         }
  34.     
  35.  
  36.     _settextposition(7,1);
  37.     printf("Page Z:");
  38.  
  39.     _settextcolor(3);
  40.     for (x=8; x<15; ++x) {
  41.         _settextposition(x,14);
  42.         _outtext("CCCCCC");
  43.         }
  44.     
  45.     _settextposition(24,10);
  46.     printf("Page Y:");
  47.  
  48.  
  49.  
  50.     _settextposition(7,35);
  51.     printf("Middle Button Anywhere       = '2'");
  52.  
  53.     _settextposition(9,35);
  54.     printf("Left Button Anywhere in Z    = '1'");
  55.  
  56.     _settextposition(10,35);
  57.     printf("Right Near Middle of Z       = 'C'");
  58.  
  59.     _settextposition(12,35);
  60.     printf("Left Button, Left  side of Y = 'L'");
  61.  
  62.     _settextposition(13,35);
  63.     printf("Left Button, Right side of Y = 'R'");
  64.  
  65.     _settextposition(14,35);
  66.     printf("Click Middle buttom to Move on");
  67.     
  68. /*************************************************************************/
  69.  
  70.     
  71.     Define_Mouse_System(M_Single_Pages);
  72.  
  73.     y=Add_Mouse_Page(M_Text_Coord,15,20,24,40); 
  74.  
  75.     z=Add_Mouse_Page(M_Text_Coord,5,10,15,20);  
  76.  
  77.  
  78.  
  79.     Set_Mouse_Text_Cursor(0,0,TC(' ',4,4));
  80.  
  81.     Add_Mouse_Button(0,M_Middle,'2');
  82.     Add_Mouse_Button(z,M_Left,'1');
  83.     Add_Mouse_Button(z,M_Right,0);
  84.     Add_Mouse_Hot_Spot(z,M_Right,7,13,13,18,'C');
  85.  
  86.     Add_Mouse_Button(y,M_Left,0);
  87.  
  88.     Add_Mouse_Hot_Spot(y,M_Left,15,20,24,30,'L');
  89.     Add_Mouse_Hot_Spot(y,M_Left,15,30,24,40,'R');
  90.  
  91.     _settextposition(3,50);
  92.     printf("# of buttons = %d\n",_mouse_there);
  93.  
  94.  
  95.     
  96. do {
  97.     
  98.  
  99.     _settextposition(1,10);
  100.     printf("Page Z Active");
  101.  
  102.     
  103.     Activate_Mouse_Page(z);
  104.     
  105.     c=Get_Char_Mouse_Kbd();
  106.  
  107.  
  108.     _settextposition(4,50);
  109.     printf("Page Z: Character \"%c\"",c);
  110.  
  111.      DeActivate_Mouse_Page(z);  
  112.  
  113.  
  114.     Activate_Mouse_Page(y);
  115.  
  116.     _settextposition(1,10);
  117.     printf("Page Y Active");
  118.  
  119.     c=Get_Char_Mouse_Kbd();
  120.  
  121.  
  122.     _settextposition(5,50);
  123.     printf("Page Y: Character \"%c\"",c);
  124.  
  125.     DeActivate_Mouse_Page(y);
  126.     
  127.     } while (c!='2');
  128.  
  129.  
  130.     Clear_All_Mouse_Definitions();
  131.  
  132.     Define_Mouse_System(M_Overlaid_Pages);
  133.  
  134.     y=Add_Mouse_Page(M_Text_Coord,15,20,24,40);
  135.  
  136.     z=Add_Mouse_Page(M_Text_Coord,5,10,15,20); 
  137.  
  138.     Add_Mouse_Button(0,M_Middle,'2');
  139.     Add_Mouse_Button(z,M_Left,'1');
  140.     Add_Mouse_Button(z,M_Right,0);
  141.     Add_Mouse_Hot_Spot(z,M_Right,7,13,13,18,'C');
  142.  
  143.     Add_Mouse_Button(y,M_Left,0);
  144.  
  145.     Add_Mouse_Hot_Spot(y,M_Left,15,20,24,30,'L');
  146.     Add_Mouse_Hot_Spot(y,M_Left,15,30,24,40,'R');
  147.  
  148.     _settextposition(3,50);
  149.     printf("# of buttons = %d\n",_mouse_there);
  150.  
  151.     Set_Mouse_Text_Cursor(0,0,TC('+',4,2));
  152.  
  153. do {
  154.     
  155.  
  156.     Activate_Mouse_Page(z);
  157.     
  158.     _settextposition(1,10);
  159.     printf("Page Z Active");
  160.  
  161.     
  162.     c=Get_Char_Mouse_Kbd();
  163.  
  164.     _settextposition(4,50);
  165.     printf("Page Z: Character \"%c\"",c);
  166.  
  167.      DeActivate_Mouse_Page(z);  
  168.  
  169.  
  170.     Activate_Mouse_Page(y);
  171.  
  172.     _settextposition(1,10);
  173.     printf("Page Y Active");
  174.  
  175.     c=Get_Char_Mouse_Kbd();
  176.  
  177.     _settextposition(5,50);
  178.     printf("Page Y: Character \"%c\"",c);
  179.  
  180.     Activate_Mouse_Page(z);
  181.     
  182.     c=Get_Char_Mouse_Kbd();
  183.  
  184.  
  185.     _settextposition(6,46);
  186.     printf("Page Y & Z: Character \"%c\"",c);
  187.     
  188.      DeActivate_Mouse_Page(y);  
  189.  
  190.     } while (c!='2');
  191.  
  192.  
  193. /***********************************************************************/
  194.  
  195.     _settextcolor(oldcolor);
  196. }
  197.  
  198.  
  199.  
  200.